Skip to main content

All Questions

0votes
1answer
763views

Is this a 'proper' use of a trait in PHP?

In Laravel 5.6 an Illuminate\Database\Eloquent\Relations\BelongsTo relation was given the ability to support default models. This allows a model that will be returned if the relationship is empty. ...
flyingL123's user avatar
0votes
1answer
196views

Using the objects retrieved at the time of request validation

I hope the question title already answers the subject here. Lets say I have a number of ids that needs to be validated in a request. Example: request uri: [POST] /album/{album_id}/song Request ...
TheManish's user avatar
3votes
0answers
204views

Is Nested Structure with Spread Responsibilities Not Logical?

Given the following code snippet in a Laravel Controller: $this->userRepository->saveByProject( $this->fileRepository->saveByProject( $this->metricRepository->...
schellingerht's user avatar
0votes
1answer
318views

static method, helper function or in the controller, where does this go?

I'm working on a piece of functionality that simply allows a guest user to perform an action a certain number of times before requiring them to login\create account. In this instance, they can vote on ...
dangelsaurus's user avatar
-1votes
1answer
1kviews

PHP: where to call helper class in MVC?

I've a helper class in Laravel 5.1 with static methods for calculating week numbers, dates in weeks, etc. (Why static? I need max. 1 instance of this helper class) I need this logic in my views. I'm ...
schellingerht's user avatar
-1votes
1answer
371views

What might be a good way to get hands on experience with Object Oriented PHP [closed]

I am a Computer Science student. I took a course on OOP, and I understand the concepts (classes, extending, encapsulation, etc). I'm also a web developer, have been doing it for about three years; I'...
Andres Zapata's user avatar

close